<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org" xmlns:layOut="http://www.w3.org/1999/xhtml"
      layOut:decorator="layOut/layOut">
<head>
    <title>用户编辑</title>
    <style>
        .main-container .layui-form-item {
            padding-right: 45px;
        }
    </style>
</head>
<body>
<form class="layui-form" id="theForm">
    <input type="hidden" name="id" th:value="${user.id}" />
    <div th:replace="sys/user/add :: theForm"></div>
    <div th:replace="sys/user/add :: theBtn"></div>
</form>
<script>
    layui.use(['form', 'jquery'], function() {
        let form = layui.form;
        let $ = layui.jquery;
        form.on('submit(completeFilter)', function(data) {
            var fromData = $("#theForm").serialize();
            console.log(data)
            console.log(fromData)
            $.post("/user/saveOrUpdate" ,data.field ,function (data) {
                if (data.status === 200) {
                    console.log("成功返回")
                }
                layer.msg(data.msg, {
                    icon: 1,       //信息框与加载层的私有参数
                    time: 1500     //意思是2.5秒后自动关闭
                }, function () {   //关闭弹出框后执行的函数
                    console.log("后端返回" + data.msg)
                });
            });
            return false;
        });
        $("#orgName").change(function () {
            $("#orgId").val($("#orgName").val());
        })
    })
</script>
</body>
</html>